<script setup>
import {reactive,computed} from 'vue'

const author = reactive({
    name: 'John Doe',
    books: [
      'Vue 2 - Advanced Guide',
      'Vue 3 - Basic Guide',
      'Vue 4 - The Mystery'
    ]
  })

//匿名内部类
  let result = computed(()=>{
    console.log("computed");
    return author.books.length > 0 ? 'Yes' : 'No' ;
  })
</script>

<template>
  <div>
    <span>{{ author.books.length > 0 ? 'Yes' : 'No' }}</span><br>
    <span>{{ author.books.length > 0 ? 'Yes' : 'No' }}</span>
{{ result }}
{{ result }}
  </div>
</template>

<style scoped>

</style>
